<template>
	<view>
		<view class="userinfo">
			<image class="imgs" :src="userinfo.img" mode="" @click="openImg(userinfo.img)"></image>
			<view class="info">
				<view class="uname">
					{{userinfo.name}}
				</view>
				<view class="uphone">
					账号：{{userinfo.phone}}
				</view>
				<view class="uphone">
					地区：西开
				</view>
			</view>
		</view>
		<view class="btns" @click="handleInfo">
			<image src="../../static/icon/icon1.png" mode=""></image>
			发消息
		</view>
		<view class="btns bor" @click="handleMessage">
			<image src="../../static/icon/icon2.png" mode=""></image>
			音视频通话
		</view>
		<uni-popup type="bottom" :safe-area="false" ref="popup">
			<view class="popup">
				<view class="btn" @click="goVoice">
					<image class="imgs" src="../../static/icon/icon4.png" mode=""></image>
					语音通话
				</view>
				<view class="btn btnbor">
					<image src="../../static/icon/icon3.png" mode=""></image>
					视频通话
				</view>
				
				<view class="bbt" @click="close">
					取消
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
                userinfo:{}
			};
		},
		onLoad(option) {
			console.log(JSON.parse(decodeURIComponent(option.userinfo)));
			this.userinfo = JSON.parse(decodeURIComponent(option.userinfo))
		},
		methods: {
			openImg(img){
				uni.previewImage({
				    urls: [img],
				});
			},
			handleInfo(){
				console.log(this.userinfo.id);
				uni.navigateTo({
					url:`/chat/chat?conversationID=C2C${this.userinfo.id}`
				})
			},
			handleMessage(){
				this.$refs.popup.open()
			},
			close(){
				this.$refs.popup.close()
			},
			goVoice(){
				uni.navigateTo({
					url:'/pages/index/voice?userinfo=' + encodeURIComponent(JSON.stringify(this.userinfo))
				})
				this.$refs.popup.close()
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f6f6f6;
	}

	.userinfo {
		width: 100%;
		padding: 60rpx 30rpx 60rpx;
		box-sizing: border-box;
		display: flex;
		border-bottom: 10rpx solid #eee;
        background-color: #fff;
		align-items: center;
		.imgs {
			width: 120rpx;
			height: 120rpx;
			border-radius: 20rpx;
		}
		.info {
			margin-left: 30rpx;
			.uname {
				font-size: 40rpx;
				font-weight: bold;
				color: #000;
				margin-bottom: 10rpx;
			}
			.uphone {
				font-size: 28rpx;
				color: #666;
				line-height: 38rpx;
			}
		}
	}

	.btns {
		width: 100%;
		height: 100rpx;
		text-align: center;
		line-height: 100rpx;
		color: #707070;
		border-radius: 10rpx;
		background-color: #fff;
		font-size: 30rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		 letter-spacing: 4rpx;
		image{
			width: 40rpx;
			height: 40rpx;
			margin-right: 20rpx;
		}
	}
	.bor{
		border-top: 1px solid #eee;
	}
	
	
	.popup{
		background-color: #fff;
		border-radius: 80rpx 80rpx 0rpx 0rpx;
		.btn {
			width: 100%;
			height: 100rpx;
			text-align: center;
			line-height: 100rpx;
			color: #000;
			border-radius: 10rpx;
			background-color: #fff;
			font-size: 30rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			.imgs{
				width: 46rpx;
				height: 40rpx;
				margin-right: 20rpx;
			}
			image{
				width: 40rpx;
				height: 40rpx;
				margin-right: 20rpx;
			}
		}
		.btnbor{
			border-top: 1px solid #eee;
			border-bottom: 20rpx solid #eee;
		}
		.bbt{
			width: 100%;
			height: 100rpx;
			text-align: center;
			line-height: 100rpx;
			padding-bottom: 40rpx;
		}
	}
</style>